/**
 * @author Administrator
 * @version V1.0
 * @ProjectName:IntelliJ IDEA
 * @PackageName: PACKAGE_NAME
 * @ClassName: student
 * @Description: TODO(这里用一句话描述这个类的作用)
 * @date 2019/10/9 13:50
 * @Copyright 金斗版板所有
 */
public class student {
    private String gender;
    private String name;
    private int age;

    public student(){}

    public student(String gender, String name, int age) {
        this.gender = gender;
        this.name = name;
        this.age = age;
    }

    public void setGender(String gender) {
        if (gender.equals("男")){
            this.gender = gender;
        }else if (gender.equals("女")){
            this.gender = gender;
        }else {
            System.out.println("性别无效！！");
        }

    }

    public void setName(String name) {
        this.name = name;
    }

    public void setAge(int age) {
        if (age<18||age>100){
            System.out.println("年龄无效！！");
            this.age=18;
        }else {
            this.age = age;
        }
    }

    public String getGender() {
        return gender;
    }

    public String getName() {
        return name;
    }

    public int getAge() {
        return age;
    }

    public void sleep(){
        String elements=String.format("学员"+this.name+"在睡觉！");
        System.out.println(elements);
    }

    public void speak(){
        String elememts=String.format(this.name+this.gender+"在说话！！");
        System.out.println(elememts);
    }

    public void study(){
        String elements=String.format(this.age+"的"+this.gender+"同学"+this.name+"在学习！！");
        System.out.println(elements);
    }
}
